package com.qf.film.view.controller;

import com.qf.film.view.pojo.FilmType;
import com.qf.film.view.service.IFilmService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

import java.util.List;

/**
 * @author King_long
 * @program: 20191025
 * @Date 2019-10-25 18:02
 */
@Controller
@SessionAttributes("filmTypes")
public class RootController {

    private static final Logger LOGGER= LogManager.getLogger(FilmController.class);

    @Autowired
    private IFilmService filmService;

    @RequestMapping("/")
    public String index(){
        LOGGER.info("欢迎来到首页");
        return "index";
    }
    @RequestMapping("/addpage")
    public String addpage(Model model){
        List<FilmType> filmTypes = filmService.selectType();
        model.addAttribute("filmTypes", filmTypes);
        return "add";
    }
    @RequestMapping("/fuzzysearchpage")
    public String fuzzysearchpage(){
        return "fuzzySearch";
    }
}
